home *** CD-ROM | disk | FTP | other *** search
/ MACD 5 / MACD 5.bin / workbench / blankery / blanker / source / blankers / fade / prefs.c < prev   
C/C++ Source or Header  |  1993-07-27  |  2KB  |  104 lines

  1. #include <exec/types.h>
  2. #include <exec/memory.h>
  3.  
  4. #include <intuition/intuition.h>
  5. #include <intuition/screens.h>
  6.  
  7. #include <libraries/gadtools.h>
  8.  
  9. #include <clib/exec_protos.h>
  10. #include <clib/dos_protos.h>
  11. #include <clib/intuition_protos.h>
  12. #include <clib/graphics_protos.h>
  13. #include <clib/alib_protos.h>
  14. #include <clib/gadtools_protos.h>
  15. #include <clib/utility_protos.h>
  16.  
  17. #include "Fade.h"
  18. #include "Fade_rev.h"
  19. #include "/defs.h"
  20. #include "/utility.h"
  21.  
  22. struct fPrefObject { LONG Delay; };
  23.  
  24. VOID blank( VOID );
  25.  
  26.     struct    fPrefObject    nP;
  27. STATIC    const    UBYTE        VersTag[] = VERSTAG;
  28. extern    struct    Task        **Task;
  29. extern        UBYTE        *prefData;
  30.  
  31. VOID setFadePrefs( VOID )
  32. {
  33.     GT_SetGadgetAttrs( FadeGadgets[GD_DELAY], FadeWnd, 0L, GTSL_Level, nP.Delay, 0L );
  34. }
  35.  
  36. int OKClicked( VOID )
  37. {
  38.     CopyMem( &nP, prefData, sizeof( struct fPrefObject ));
  39.     return( QUIT );
  40. }
  41.  
  42. int TESTClicked( VOID )
  43. {
  44.     *Task = FindTask( 0L );
  45.     blank();
  46.     return( CONTINUE );
  47. }
  48.  
  49. int CANCELClicked( VOID )
  50. {
  51.     return( QUIT );
  52. }
  53.  
  54. int DELAYClicked( VOID )
  55. {
  56.     nP.Delay = FadeMsg.Code;
  57.     return( CONTINUE );
  58. }
  59.  
  60. int FadeVanillaKey( VOID )
  61. {
  62.     switch( FadeMsg.Code ) {
  63.     case 'o':
  64.         return( OKClicked() );
  65.     case 'c':
  66.         return( CANCELClicked() );
  67.     case 'd':
  68.         GT_SetGadgetAttrs( FadeGadgets[GD_DELAY], FadeWnd, 0L, GTSL_Level, ++(nP.Delay) > 59 ?
  69.             nP.Delay = 59 : nP.Delay, 0L );
  70.         return( CONTINUE );
  71.     case 'D':
  72.         GT_SetGadgetAttrs( FadeGadgets[GD_DELAY], FadeWnd, 0L, GTSL_Level, --(nP.Delay) < 0 ? nP.Delay = 0 :
  73.             nP.Delay , 0L );
  74.         return( CONTINUE );
  75.     case 't':
  76.         return( TESTClicked() );
  77.     default:
  78.         return( CONTINUE );
  79.     }
  80. }
  81.  
  82. VOID prefs( LONG command )
  83. {
  84.     switch( command ) {
  85.     case STARTUP:
  86.         CopyMem( prefData, &nP, sizeof( struct fPrefObject ));
  87.         if( !SetupScreen() ) {
  88.             if( !OpenFadeWindow()) setFadePrefs();
  89.             CloseDownScreen();
  90.         }
  91.         break;
  92.     case IDCMP:
  93.         if( HandleFadeIDCMP() != QUIT ) break;
  94.     case KILL:
  95.         CloseFadeWindow();
  96.         break;
  97.     }        
  98. }
  99.  
  100. LONG winSig( VOID )
  101. {
  102.     return( FadeWnd ? ( 1l << FadeWnd->UserPort->mp_SigBit ) : 0l );
  103. }
  104.